package com.irdstudio.tdp.executor.core.plugin.gencode;

public class AppModelInfoConstant {

    public static final String DATA_MODEL_CATALOG = "I01";//业务模型分类
    public static final String API_TREE_MODEL_CATALOG = "A00";//业务模型分类 外部服务 tree
    public static final String API_MODEL_CATALOG = "A01";//业务模型分类 外部服务
    public static final String DATA_PACKAGE_ID = "001001";//目录包标识
    public static final String DEFAULT_USER_ID = "system";//默认用户
    /**
     * 数据模型枚举类
     *
     */
    public enum DataServiceModelEnum {
        QUERY("Query", "查询", "I0101", "数据查询模型"),
        ADD("Add", "新增", "I0102", "数据新增模型"),
        UPDATE("Update", "修改", "I0103", "数据修改模型"),
        DELETE("Delete", "删除", "I0104", "数据删除模型"),
        SINGLE("Single", "单条", "I0105", "单条数据模型"),;
        private String code;
        private String name;
        private String type;
        private String remark;

        private DataServiceModelEnum(String code, String name, String type, String remark) {
            this.code = code;
            this.name = name;
            this.type = type;
            this.remark = remark;
        }

        public String getCode() {
            return code;
        }
        public String getName() {
            return name;
        }
        public String getType() {
            return type;
        }
        public String getRemark() {
            return remark;
        }

        public static DataServiceModelEnum getModelByType(String code) {
            if (code == null) {
                return null;
            }
            for (DataServiceModelEnum e : DataServiceModelEnum.values()) {
                if (e.getType().equals(code)) {
                    return e;
                }
            }
            return null;
        }
    }

    /**
     * app_mode_node_inout io_type
     */
    public enum IO_TYPE {
        I("I", "输入"),
        O("O", "输出 ");

        private String code;
        private String name;
        IO_TYPE(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public String getCode() {
            return code;
        }

        public String getName() {
            return name;
        }
    }

    /**
     * osrv_node_info node_type
     * 模型输入、内部服务、模型输出
     */
    public enum NODE_TYPE {
        INPUT_SERVICE("00", "输入参数", true),
        VALIDATE_SERVICE("01", "数据校验", false),
        TRAN_SERVICE("02", "数据清洗", false),
        INNER_SERVICE("03", "内部服务", true),
        OUTPUT_SERVICE("99", "输出参数", true);

        private String code;
        private String name;
        private Boolean init;
        NODE_TYPE(String code, String name, Boolean init) {
            this.code = code;
            this.name = name;
            this.init = init;
        }

        public String getCode() {
            return code;
        }

        public String getName() {
            return name;
        }

        public Boolean getInit() {
            return init;
        }
    }

    /**
     * 业务模型分类枚举值
     */
    public enum AppModelCatalogEnum {

        APP_MODEL_CATALOG_A01("A01", "外部服务"),
        APP_MODEL_CATALOG_F00("F00", "前端页面"),
        APP_MODEL_CATALOG_I00("I00", "内部服务"),
        APP_MODEL_CATALOG_I01("I01", "数据服务"),
        APP_MODEL_CATALOG_I11("I11", "流程服务"),
        APP_MODEL_CATALOG_I91("I91", "第三方服务"),;

        private String code;
        private String name;

        private AppModelCatalogEnum(String code, String text) {
            this.code = code;
            this.name = text;
        }

        public String getName() {
            return name;
        }
        public String getCode() {
            return code;
        }
    }

    /**
     * 业务模型类型枚举值
     */
    public enum AppModelTypeEnum {

        APP_MODEL_TYPE_A0101("A0101", "外部服务模型"),
        APP_MODEL_TYPE_I0101("I0101", "数据查询模型"),
        APP_MODEL_TYPE_I0102("I0102", "数据新增模型"),
        APP_MODEL_TYPE_I0103("I0103", "数据修改模型"),
        APP_MODEL_TYPE_I0104("I0104", "数据删除模型"),
        APP_MODEL_TYPE_I0105("I0105", "单条数据模型"),

        APP_MODEL_TYPE_F0101("F0101", "前端页面模型"),
        ;

        private String code;
        private String name;

        private AppModelTypeEnum(String code, String text) {
            this.code = code;
            this.name = text;
        }

        public String getName() {
            return name;
        }
        public String getCode() {
            return code;
        }
    }

    public enum ApiServiceModeInfoOpEnum {
        Query("Query", "查询"),
        Add("Add", "新增"),
        Update("Update", "修改"),
        Delete("Delete", "删除"),
        Single("Single", "单条")
        ;


        private String code;
        private String name;
        ApiServiceModeInfoOpEnum(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public String getCode() {
            return code;
        }

        public String getName() {
            return name;
        }
    }

    /**
     query	查询
     grid	表格
     kv	键值对
     tabs	标签页
     tree	导航树
     form	表单
     */
    public enum FrontPageParamTypeEnum {
        QUERY("query", "页面查询"),
        GRID("grid", "页面表格"),
        KV("kv", "键值对"),
        TABS("tabs", "标签页"),
        TREE("tree", "导航树"),
        FORM("form", "页面表单")
        ;
        private String code;
        private String name;
        FrontPageParamTypeEnum(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public String getCode() {
            return code;
        }

        public String getName() {
            return name;
        }
    }

    public enum PageButtonEnum {
        SAVE("save", "保存", FrontPageParamTypeEnum.FORM),
        RETURN("return", "返回", FrontPageParamTypeEnum.FORM),
        ADD("add", "新增", FrontPageParamTypeEnum.GRID),
        UPDATE("update", "修改", FrontPageParamTypeEnum.GRID),
        DELETE("delete", "删除", FrontPageParamTypeEnum.GRID),
        VIEW("view", "查看", FrontPageParamTypeEnum.GRID)
        ;
        private String code;
        private String name;
        private FrontPageParamTypeEnum type;
        PageButtonEnum(String code, String name, FrontPageParamTypeEnum type) {
            this.code = code;
            this.name = name;
            this.type = type;
        }

        public String getCode() {
            return code;
        }

        public String getName() {
            return name;
        }

        public FrontPageParamTypeEnum getType() {
            return type;
        }
    }


    public enum BpmNodeTypeEnum {

        Start("N01", "开始节点"),
        PluginApproveConf("N03", "审批节点"),
        PluginCountersignConf("N04", "会签节点"),
        PluginContentionConf("N05", "竟办节点"),
        PluginAssignConf("N06", "分单节点"),
        Task("N07", "内部服务"),
        End("N99", "结束节点");

        private String code;
        private String name;
        BpmNodeTypeEnum(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public String getCode() {
            return code;
        }

        public String getName() {
            return name;
        }

        public static BpmNodeTypeEnum get(String code) {
            if (code == null) {
                return null;
            }
            for (BpmNodeTypeEnum type : BpmNodeTypeEnum.values()) {
                if (type.getCode().equals(code)) {
                    return type;
                }
            }
            return null;
        }
    }
}
